let person = {
    name:'daxia',
    profession:{
        title:'frontender'
    }
}


Object.freeze(person);
person.name = 'dd';
person.profession.title = 'singer';

console.log(person);

function deepFreeze(obj) {
    Object.freeze(obj);
    for(let key in obj) {
        
        if(typeof obj[key] === 'object' && obj[key] !== null) {
            deepFreeze(obj[key]);
        }
    }
}

deepFreeze(person);
person.profession.title = 'coolman';
